-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New @turnkey/iframe-stamper
package and email recovery example
#129
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very minor nit: let's show this off in our top level README 🤩
but otherwise. this. looks. great!!!
/** | ||
* Inserts the iframe on the page and returns a promise resolving to the iframe's public key | ||
*/ | ||
async init(): Promise<string> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🏅 nice!!!
packages/iframe-stamper/src/index.ts
Outdated
// Instead of erroring out we simply return. Not our event! | ||
return; | ||
} | ||
if (event.data && event.data["type"] == "BUNDLE_INJECTED") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny nit - same optional chaining pattern here (don't feel strongly).
could be useful to throw some of these types into consts in a single place
c0f7f9c
to
16a167e
Compare
Summary & Motivation
This PR adds a new package:
@turnkey/iframe-stamper
. This is an abstraction to work with iframes as signers (aka stampers).Right now I envision
@turnkey/iframe-stamper
to be used mostly via our upcoming email recovery flow, but I can see this "iframe as stampers" idea being useful for other flows in the future: iframes and localStorage could be used to hold standard API keys rather than recovery credentials.The new example covers the recovery flow.
How I Tested These Changes
recovery-first-cut.mov
Local testing for now. There's still a bunch of work that needs to be done to complete the example, but having this PR out in the open will be useful to get feedback!